﻿using System;
using System.Collections.Generic;
//using System.Linq;
using System.Text;
using System.Drawing;

namespace WellLogShower
{
    class SpaceAllocater
    {
        private int curveCount;
        private RectangleF outRect;

        public SpaceAllocater(RectangleF rect, int count)
        {
            curveCount = count;
            outRect = rect;

        }

        public RectangleF FrameRect()
        {
            return new RectangleF(outRect.X + 10,outRect.Y + 10 ,outRect.Width - 20,outRect.Height - 20);
        }

        public RectangleF TitleRect()
        {
            return new RectangleF(FrameRect().X + 10,FrameRect().Y + 10 ,outRect.Width - 20,20);
        }
        
        public List<RectangleF> HeaderRect()
        {
            List<RectangleF> listRect = new List<RectangleF>() ;

            float curveWidth = FrameRect().Width / (float)curveCount;
            for(int i=0;i<curveCount;i++)
            {
                listRect.Add(new RectangleF(FrameRect().X + i * curveWidth ,TitleRect().Bottom,curveWidth,40));
            }
            return listRect;
        }

        public List<RectangleF> CurveRect()
        {
            List<RectangleF> listRect = new List<RectangleF>() ;
            List<RectangleF> HeadRect = HeaderRect() ;

            float curveWidth = FrameRect().Width / (float)curveCount;
            for(int i=0;i<curveCount;i++)
            {
                listRect.Add(new RectangleF(HeaderRect()[i].X ,HeaderRect()[i].Bottom,HeaderRect()[i].Width,FrameRect().Bottom - HeaderRect()[i].Bottom));
            }
            return listRect;
        }


    }
}
